const path = require('path');
const webpack = require('webpack');
const html = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
	mode:'development',
	entry:'./src/index.js',
	output:{
		path:path.join(__dirname,'./dist/'),
		filename:'main.js'
	},
	devServer:{
		port:8848,
		host:'127.0.0.1',
		contentBase:'src'
	},
	plugins:[
		new html({
			template:path.join(__dirname,"./src/index.html"),
			filename:"index.html"
		}),
		new VueLoaderPlugin()
	],
	module:{
		rules:[
			{test:/\.css$/,use:['style-loader','css-loader']},
			{test:/\.scss$/,use:['style-loader','css-loader','sass-loader']},
			{test:/\.(jpg|png|bmp|jpeg|gif)/,use:'url-loader?limit=2000&name=images/[hash:2]-[name].[ext]'},
			{test:/\.(eot|svg|woff|woff2|ttf)$/,use:'url-loader'},
			{test:/\.js$/,use:'babel-loader',exclude:/node_modules/},
			{test:/\.vue$/,use:'vue-loader'}
		]
	},
	resolve:{
		alias:{
			"vue$":"vue/dist/vue.js"
		}
	}
}